import 'package:flutter/cupertino.dart';

///
/// 基础 ViewModel 抽象类
///
abstract class BaseViewModel with ChangeNotifier {
  final BuildContext context;

  BaseViewModel(this.context);

  bool _isLoading = false;

  bool get isLoading => _isLoading;

  set isLoading(bool isLoading) {
    if (_isLoading != isLoading) {
      _isLoading = isLoading;
    }
    notifyListeners();
  }

  /// 刷新数据
  @protected
  Future refreshData({bool isShowLoading = false});
}
